package com.cdivtc.management.controller;

import com.cdivtc.management.pojo.Result;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@ControllerAdvice
@RestController
public class BaseExceptionHandler {
    @ExceptionHandler(value = IllegalArgumentException.class)
    @ResponseBody
    public Result IllegalArgumentException(Exception e) {
        e.printStackTrace();
        return new  Result().error(e.getMessage());
    }   @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result error(Exception e) {
        e.printStackTrace();
        return new  Result().error(e.getMessage());
    }
    @ExceptionHandler(value = IOException.class)
    @ResponseBody
    public void IOException(Exception e) {


    }
}

